Next: , Previous: Posting Server, Up: Composing Messages


5.3 POP before SMTP

Does your ISP require the POP-before-SMTP authentication? It is whether you need to connect to the POP mail server within a certain time before sending mails. If so, there is a convenient way. To do that, put the following lines in your ~/.gnus.el file:

     (setq message-send-mail-function 'message-smtpmail-send-it)
     (add-hook 'message-send-mail-hook 'mail-source-touch-pop)

It means to let Gnus connect to the POP mail server in advance whenever you send a mail. The mail-source-touch-pop function does only a POP authentication according to the value of mail-sources without fetching mails, just before sending a mail. Note that you have to use message-smtpmail-send-it which runs message-send-mail-hook rather than smtpmail-send-it and set the value of mail-sources for a POP connection correctly. See Mail Sources.

If you have two or more POP mail servers set in mail-sources, you may want to specify one of them to mail-source-primary-source as the POP mail server to be used for the POP-before-SMTP authentication. If it is your primary POP mail server (i.e., you are fetching mails mainly from that server), you can set it permanently as follows:

     (setq mail-source-primary-source
           '(pop :server "pop3.mail.server"
                 :password "secret"))

Otherwise, bind it dynamically only when performing the POP-before-SMTP authentication as follows:

     (add-hook 'message-send-mail-hook
               (lambda ()
                 (let ((mail-source-primary-source
                        '(pop :server "pop3.mail.server"
                              :password "secret")))
                   (mail-source-touch-pop))))